<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>小米官网后台管理</title>
<script type="text/javascript" charset="UTF-8"
	src="../js/prefixfree.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/base.css" media="all" />
<link rel="stylesheet" type="text/css" href="../css/self.css" media="all" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="../viewport" content="width=device-width, initial-scale=1">
<link href="../css/bootstrap.css" rel="stylesheet">
<script src="../js/jquery-1.12.4.min.js"></script>
<script src="../js/bootstrap.js"></script>
<!-- 以上五个是在使用bootstrap时需要导入的 -->
<style type="text/css">
iframe {
	width: 100%;
	height: 100%;
}
</style>
</head>
<body>
	<div class="page">
		<section class="demo">
			<div class="admin-panel clearfix">
				<div class="slidebar">
					<div class="logo">
						<img id="logoimg" src="../img/logo_min.jpg">
					</div>
					<ul>
						<li id="to_users"><a href="javascript:void(0)">用户管理</a></li>
						<li id="to_goods"><a href="javascript:void(0)">商品管理</a></li>
						<li id="to_goodAdd"><a href="javascript:void(0)">商品添加</a></li>
						<li id="to_types"><a href="javascript:void(0)">类别管理</a></li>
						<li id="to_typeAdd"><a href="javascript:void(0)">类别添加</a></li>
						<li id="to_person"><a href="javascript:void(0)">个人中心</a></li>
					</ul>
				</div>
				<div class="main">
					<c:if test="${admin!=null }">
						<iframe id="frame" src="../welcome.jsp"></iframe>
					</c:if>
				</div>
			</div>
	</div>
	</section>
	</div>
	<input type="hidden" id="user" value="${admin }">
	<script type="text/javascript">
		console.log($("#user").val());
		if ($("#user").val() == "") {
			location.href="../index.html";
		} else {
			$("#to_users").click(function() {
				$.post("../../admin_user",{
					op:'getUserByPage',
					page:1
				},function(data){
					console.log(data);
					if(data>0){
						$("#frame").attr("src", "users.jsp#page=1");
					}else{
						alert("暂无数据");
					}
				},"json");
			});
			
			$("#to_goods").click(function() {
				$.post("../../admin_good",{
					op:'getGoodsbyPage'
				},function(data){
					console.log(data);
					if(data>0){
						$("#frame").attr("src", "goods.jsp#type=0&page=1");
					}else{
						alert("暂无数据");
					}
				},"json");
			});
			
			$("#to_types").click(function() {
				$.post("../../admin_type",{
					op:'getTypeByPage'
				},function(data){
					console.log(data);
					if(data>0){
						$("#frame").attr("src", "types.jsp#page=1");
					}else{
						alert("暂无数据");
					}
				});
			});
			
			$("#to_goodAdd").click(function() {
				$.post("../../admin_type",{
					op:'getTypeByPage'
				},function(data){
					console.log(data);
					if(data>0){
						$("#frame").attr("src", "goodAdd.jsp");
					}else{
						alert("暂无商品类目!请先添加商品类目!再添加商品!");
					}
				});
			});
			
			$("#to_typeAdd").click(function() {
				$("#frame").attr("src", "typeAdd.html");
			});
			$("#to_person").click(function() {
				$("#frame").attr("src", "person.jsp");
			});
		}
		$("#logoimg").click(function() {
			$("#frame").attr("src", "../welcome.jsp");
		});
		
		
	</script>
</body>
</html>